package com.audaque.springboot.foshanupload.web.quartzdemo.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * @author zgb
 * @desc 默认的无状态 job，每次调用时都会创建一个新的JobDataMap
 * @date 2023-04-30 13:02:39
 */

public class MyJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("任务被执行了。。。");
        context.getTrigger().getJobDataMap().get("tiggerDataMap");
        long count = (long) context.getJobDetail().getJobDataMap().get("count");
        System.out.println("当前执行，第" + count + "次");
        context.getJobDetail().getJobDataMap().put("count", ++count);
    }
}
